<?	
	/* Se asegura que el archivo es incluido por el index */
	defined( 'LOAD_MODULE_ACTION' ) or die( 'No esta permitido el acceso directo a ' . __FILE__ );  
		$this->oTmpObject = new Home_celda_frm( $this );
	
	class Home_celda_frm extends Frm
	{
	function setValue ( $ncCelda, $ncHome )
		{
			$cSql = "SELECT  ncDetalle,  ncTipoCelda,  cdCelda,  nFila,  nColumna,  nqFilas,  nqColumnas,  cFondo
				FROM gtHomeCelda
				WHERE ncCelda = '$ncCelda' AND  ncHome = '$ncHome' ";
			$aDatos = $this->oDatabase->getArray($cSql);	
			$this->setFieldsArray ( $aDatos );
		}
	function Home_celda_frm( &$oModule )
		{
			$this->Frm( $oModule );
			//Crea los Objetos de los campos de edicion
			$this->aFields['ncCelda']				= new InputList( "ncCelda" );
			$this->aFields['ncHome']				= new InputList( "ncHome" );
			$this->aFields['ncDetalle']			= new InputList( "ncDetalle" );
			$this->aFields['ncTipoCelda']		= new InputList( "ncTipoCelda" );
			$this->aFields['cdCelda']				= new InputText( "cdCelda" );
			$this->aFields['nFila']					= new InputNumber( "nFila" );
			$this->aFields['nColumna']			= new InputNumber( "nColumna" );
			$this->aFields['nqFilas']				= new InputNumber( "nqFilas" );
			$this->aFields['nqColumnas']		= new InputNumber( "nqColumnas" );
			$this->aFields['cFondo']				= new InputText( "cFondo" );	
		}	
	function setLevel( $nLevel)
		{
			switch ( $nLevel )
			{
				case 1: 
					$this->aInput = array ('ncCelda','ncHome', 'ncCelda', 'ncHome', 'ncDetalle', 'ncTipoCelda' );
					break;
				case 2: 
					$this->aInput = array ('ncCelda','ncHome','ncDetalle','ncTipoCelda','cdCelda','nFila','nColumna','nqFilas','nqColumnas','cFondo' );
					break;
			}
		}
	function initializeForm()
		{
			// Si viene el Ubicacion hace el retrieve
				if ( $this->isRetrievable() && $this->aFields['ncCelda']->getValue() && $this->aFields['ncHome']->getValue() )
				{
					$this->setValue( $this->aFields['ncCelda']->getValue(), $this->aFields['ncHome']->getValue() );
				}
			// Configura el Titulo
				$this->setLabel( "HomeCelda" );	
			return true;
		}
	function initializeField( $cField , &$oField )
		{			
			switch ( $cField )
			{
					case 'ncCelda':
						$oField->setHidden();
					break;
					case 'ncHome':
						$oField->setLabel('Home');
						$cSql = "SELECT ncHome, cdHome FROM gtHome";
						$oField->setMatrix($this->oDatabase->getMatrix($cSql));
						$oField->setMandatory($this->isMandatory());
					break;
					case 'ncDetalle':
						$oField->setLabel('Contenido Fijo');
						$cSql = "SELECT ncDetalle, cdDetalle  FROM gtHomeDetalle WHERE ncHome = " . $this->aFields['ncHome']->getValue() . " AND ncCelda= " . $this->aFields['ncCelda']->getValue();
						$oField->setMatrix($this->oDatabase->getMatrix($cSql));
					break;
					case 'ncTipoCelda':
						$oField->setLabel('Tipo');
						$cSql = "SELECT ncTipoCelda, cdTipoCelda FROM gcTipoCelda";
						$oField->setMatrix($this->oDatabase->getMatrix($cSql));
						$oField->setMandatory($this->isMandatory());
					break;
					case 'cdCelda':
						$oField->setLabel('Nombre');
					break;
					case 'nFila':
						$oField->setLabel('Fila');
					break;
					case 'nColumna':
						$oField->setLabel('Columna');
					break;
					case 'nqFilas':
						$oField->setLabel('Cant Filas');
						$oField->setDefault(1);
					break;
					case 'nqColumnas':
						$oField->setLabel('Cant Columnas');
						$oField->setDefault(1);
					break;
					case 'cFondo':
						$oField->setLabel('Fondo');
					break;
			}
 		}
	}
?>